﻿using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
using System.Collections.Generic;

public class ScriptMenu : MonoBehaviour
{
	[MenuItem("Assets/Create Script")]
	private static void CreateScript()
	{
		EditorWindow.GetWindow<CreateScriptWindow>("Create Script");
	}

	[MenuItem("Assets/Create Script", true)]
	private static bool CanCreateScript()
	{
		return Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets).Length > 0;
	}

	[MenuItem("Assets/Edit Script")]
	private static void EditScript()
	{
		EditScriptWindow window = EditorWindow.GetWindow<EditScriptWindow>("Edit Script");

		window.InitScript(Selection.activeObject as MonoScript);
	}
	
	[MenuItem("Assets/Edit Script", true)]
	private static bool CanEditScript()
	{
		return Selection.activeObject.GetType() == typeof(MonoScript);
	}
}
